package com.CS3340.project;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class card {
	private char suit;
	private int number;
	private BufferedImage image;	//image of the card
	private String name =" ";
	
	
	public card(){				//creating a joker for calling card()
		suit = 'J';
		number = 99;
		
		
		try {
			image = ImageIO.read(new File("src/images/jr.gif"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public card(char in_suit, int in_number){		//creating card by calling card(suit,number)
		suit=in_suit;
		number=in_number;
		String tempchar = " ";
		
		if (number == 11)
			tempchar = "j";
		else if (number == 12)
			tempchar = "q";
		else if (number == 13 )
			tempchar = "k";
		else
		tempchar = Integer.toString(number);
		
		name = "src/images/"+suit+tempchar+".gif";
		try {
			image = ImageIO.read(new File(name)); //directly print out the card
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public card (card in_card){				//creating a card with card(temp_card) 
		suit=in_card.suit;
		number=in_card.number;
	}
	
	public char getSuit(){
		return suit;
	}
	
	public int getNumber(){
		return number;
	}
	
	public BufferedImage printImage() {	
		return image;
	}
	
	public void print(){								//please re-write the print function for printing the card on GUI
		System.out.println(suit+" "+ number);	// this print function is for testing only
	}
	
	public void changeace(){
		number =14;
	}
	
	public void changeace2(){
		number =1;
	}
	
	public int checksuit(){
		if (suit =='s')
			return 4;
		else if (suit =='h')
			return 3;
		else if (suit =='c')
			return 2;
		else 
			return 1;				
	}

}